function myAjax(options) {
	const method = options.method || "GET"
	const url = options.url
	// const data = options.data || null
	const data = options.data ? JSON.stringify(options.data) : null;
	const success = options.success || function() {}
	const error = options.error || function() {}
	const xhr = new XMLHttpRequest()
	xhr.open(method, url)
	xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8")
	xhr.send(data)
	xhr.responseType = "json"
	xhr.onreadystatechange = function() {
		if (xhr.readyState === 4) {
			if (xhr.status >= 200 && xhr.status < 400) {
				success(xhr.response)
			} else{
				// console.log(error)
				error(xhr.statusText)
			}
		}
	}
}
